We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to keep the content between "<>" ?

The data stores in the database is correct, I just read it out with $topic = Topics::findFirstById($id) and output it with {{ topic.content }}, then the content between "<" and ">" disappear

For example, in database content( the content is some code,including the first line):


` ``cpp
#include <iostream>
using namespace std;
` ``

but its output is:

` ``cpp
#include
using namespace std;
` ``

the code <iostream> disappeared! how to keep it?



9.5k
edited Mar '16

Have you tried encoding before saving it then decoding after retrieval? I think that would preserve some characters that were disappearing.

Let me know if that worked. Thanks.



31.3k

how to encode and decode?

Have you tried encoding before saving it then decoding after retrieval? I think that would preserve some characters that were disappearing.

Let me know if that worked. Thanks.



9.5k
Accepted
answer

There are several. You can start with htmlentities() or htmlspecialchars(). Then decode it again after retrieval.



9.5k

Is this issue already fixed? I was wondering if things worked out for you.

how to encode and decode?

Have you tried encoding before saving it then decoding after retrieval? I think that would preserve some characters that were disappearing.

Let me know if that worked. Thanks.



31.3k

yeah~ Thanks!

Is this issue already fixed? I was wondering if things worked out for you.

how to encode and decode?

Have you tried encoding before saving it then decoding after retrieval? I think that would preserve some characters that were disappearing.

Let me know if that worked. Thanks.



9.5k

Great for you then. :)

yeah~ Thanks!

Is this issue already fixed? I was wondering if things worked out for you.

how to encode and decode?

Have you tried encoding before saving it then decoding after retrieval? I think that would preserve some characters that were disappearing.

Let me know if that worked. Thanks.